﻿using System;
using UnityEngine;
using UnityEngine.EventSystems;

namespace AladdinGameFramework.UGUI
{
	public class CUIEventTriggerListener : EventTrigger
	{
		public delegate void CUIEventDelegate(GameObject go);
		public delegate void CUIEventBaseDelegate(GameObject go, BaseEventData data);
		public delegate void CUIEventPointDelegate(GameObject go, PointerEventData point);
		public CUIEventTriggerListener.CUIEventDelegate onClick;
		public CUIEventTriggerListener.CUIEventDelegate onDown;
		public CUIEventTriggerListener.CUIEventDelegate onEnter;
		public CUIEventTriggerListener.CUIEventDelegate onExit;
		public CUIEventTriggerListener.CUIEventDelegate onUp;
		public CUIEventTriggerListener.CUIEventDelegate onSelect;
		public CUIEventTriggerListener.CUIEventDelegate onUpdateSelect;
		public CUIEventTriggerListener.CUIEventBaseDelegate onDeselect;
		public CUIEventTriggerListener.CUIEventBaseDelegate onCancel;
		public CUIEventTriggerListener.CUIEventPointDelegate onDrag;
		public CUIEventTriggerListener.CUIEventPointDelegate onDragBegin;
		public CUIEventTriggerListener.CUIEventPointDelegate onDragEnd;
		public static CUIEventTriggerListener Get(GameObject go)
		{
			CUIEventTriggerListener cUIEventTriggerListener = go.GetComponent<CUIEventTriggerListener>();
			bool flag = cUIEventTriggerListener == null;
			if (flag)
			{
				cUIEventTriggerListener = go.AddComponent<CUIEventTriggerListener>();
			}
			return cUIEventTriggerListener;
		}
		public override void OnCancel(BaseEventData data)
		{
			base.OnCancel(data);
			bool flag = this.onCancel != null;
			if (flag)
			{
				this.onCancel(base.gameObject, data);
			}
		}
		public override void OnPointerClick(PointerEventData eventData)
		{
			base.OnPointerClick(eventData);
			bool flag = this.onClick != null;
			if (flag)
			{
				this.onClick(base.gameObject);
			}
		}
		public override void OnPointerDown(PointerEventData eventData)
		{
			base.OnPointerDown(eventData);
			bool flag = this.onDown != null;
			if (flag)
			{
				this.onDown(base.gameObject);
			}
		}
		public override void OnPointerEnter(PointerEventData eventData)
		{
			base.OnPointerEnter(eventData);
			bool flag = this.onEnter != null;
			if (flag)
			{
				this.onEnter(base.gameObject);
			}
		}
		public override void OnPointerExit(PointerEventData eventData)
		{
			base.OnPointerExit(eventData);
			bool flag = this.onExit != null;
			if (flag)
			{
				this.onExit(base.gameObject);
			}
		}
		public override void OnPointerUp(PointerEventData eventData)
		{
			base.OnPointerUp(eventData);
			bool flag = this.onUp != null;
			if (flag)
			{
				this.onUp(base.gameObject);
			}
		}
		public override void OnSelect(BaseEventData eventData)
		{
			base.OnSelect(eventData);
			bool flag = this.onSelect != null;
			if (flag)
			{
				this.onSelect(base.gameObject);
			}
		}
		public override void OnUpdateSelected(BaseEventData eventData)
		{
			base.OnUpdateSelected(eventData);
			bool flag = this.onUpdateSelect != null;
			if (flag)
			{
				this.onUpdateSelect(base.gameObject);
			}
		}
		public override void OnDeselect(BaseEventData eventData)
		{
			base.OnDeselect(eventData);
			bool flag = this.onDeselect != null;
			if (flag)
			{
				this.onDeselect(base.gameObject, eventData);
			}
		}
		public override void OnDrag(PointerEventData eventData)
		{
			base.OnDrag(eventData);
			bool flag = this.onDrag != null;
			if (flag)
			{
				this.onDrag(base.gameObject, eventData);
			}
		}
		public override void OnBeginDrag(PointerEventData eventData)
		{
			base.OnBeginDrag(eventData);
			bool flag = this.onDragBegin != null;
			if (flag)
			{
				this.onDragBegin(base.gameObject, eventData);
			}
		}
		public override void OnEndDrag(PointerEventData eventData)
		{
			base.OnEndDrag(eventData);
			bool flag = this.onDragEnd != null;
			if (flag)
			{
				this.onDragEnd(base.gameObject, eventData);
			}
		}
	}
}